/* JavaLog - package tracker 
 * 
 * Copyright (C) 2009  Allyson Lima, Diego Pedro, Victor Freire
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software 
 * Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this 
 * program.  If not, see <http://www.gnu.org/licenses/>.
 */
package br.edu.ufcg.ccc.javalog.view;
import java.awt.event.ActionEvent;
import java.awt.event.WindowEvent;

import javax.swing.AbstractAction;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import br.edu.ufcg.ccc.javalog.controller.FranchiseController;
import br.edu.ufcg.ccc.javalog.controller.HeadquartersController;
import br.edu.ufcg.ccc.javalog.event.FranchiseEvent;
import br.edu.ufcg.ccc.javalog.exceptions.FranchiseControllerException;
import br.edu.ufcg.ccc.javalog.exceptions.HeadquartersControllerException;
import br.edu.ufcg.ccc.javalog.listener.FranchiseListener;
import br.edu.ufcg.ccc.javalog.model.Address;
import br.edu.ufcg.ccc.javalog.model.Franchise;
import br.edu.ufcg.ccc.javalog.model.Headquarters;
import br.edu.ufcg.ccc.javalog.model.Validator;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
/**
 * View for managing a franchise.
 * 
 * @author Allyson Lima, Diego Pedro, Victor Freire
 * @version 03/12/09
 */
@SuppressWarnings("serial")
public class FranchiseView extends AbstractView implements FranchiseListener {
	private Franchise franchise;
	private FranchiseController franchiseController;
	private HeadquartersController headquartersController;
	
	private JTextField textNumber;
	private JLabel labelState;
	private JLabel labelRegion;
	private JLabel labelName;
	private JFormattedTextField textZipcode;
	private JTextField textDistrict;
	private JTextField textStreet;
	private JTextField textCity;
	private JTextField textState;
	private JComboBox comboRegion;
	private JTextField textName;
	private JCheckBox checkHasAirport;
	private JLabel labelNumber;
	private JLabel labelCity;
	private JLabel labelZipcode;
	private AbstractAction actionNearestFranchises;
	private JLabel labelHeadquarters;
	private JButton buttonNearestFranchises;
	private AbstractAction actionModify;
	private AbstractAction actionDelete;
	private AbstractAction actionBack;
	private JButton buttonBack;
	private JButton buttonDelete;
	private JButton buttonModify;
	private JLabel labelDistrict;
	private JLabel labelStreet;
		
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				FranchiseView inst = new FranchiseView();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	private FranchiseView() {
		super();
		initGUI();
	}
	
	/**
	 * Creates this view for the specified franchise model object.
	 * @param headquarters the model to view
	 * @param franchises the model to view
	 */
	public FranchiseView(Headquarters headquarters, Franchise franchise) {
		this();
		Validator.validateObject(franchise, new IllegalArgumentException("null franchise received"));
		this.franchiseController = new FranchiseController(franchise);
		this.headquartersController = new HeadquartersController(headquarters);
		this.franchise = franchise;
		this.franchise.addFranchiseListener(this);
		labelHeadquarters.setVisible(false);
		if(franchise.equals(headquarters)) {
//			buttonModify.setEnabled(false);
			buttonDelete.setEnabled(false);
			labelHeadquarters.setVisible(true);
		}
		refreshView();
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			{
				textNumber = new JTextField();
			}
			{
				labelNumber = new JLabel();
				labelNumber.setText("Nº:");
			}
			{
				checkHasAirport = new JCheckBox();
				checkHasAirport.setText("Tem aeroporto:");
				checkHasAirport.setHorizontalAlignment(SwingConstants.LEFT);
				checkHasAirport.setHorizontalTextPosition(SwingConstants.LEFT);
				checkHasAirport.setHideActionText(true);
			}
			{
				textName = new JTextField();
			}
			{
				ComboBoxModel comboRegionModel = 
					new DefaultComboBoxModel(
							Address.getValidRegions().toArray(new String[1]));
				comboRegion = new JComboBox();
				comboRegion.setModel(comboRegionModel);
				comboRegion.setEnabled(false);
			}
			{
				textState = new JTextField();
				textState.setEnabled(false);
			}
			{
				textCity = new JTextField();
				textCity.setEnabled(false);
			}
			{
				textStreet = new JTextField();
			}
			{
				textDistrict = new JTextField();
			}
			{
				textZipcode = new JFormattedTextField(ViewUtil.getZipcodeFormatter());
			}
			{
				labelName = new JLabel();
				labelName.setText("Nome: ");
			}
			{
				labelRegion = new JLabel();
				labelRegion.setText("Região:");
			}
			{
				labelState = new JLabel();
				labelState.setText("Estado:");
			}
			{
				labelCity = new JLabel();
				labelCity.setText("Cidade:");
			}
			{
				labelStreet = new JLabel();
				labelStreet.setText("Endereço:");
			}
			{
				labelDistrict = new JLabel();
				labelDistrict.setText("Bairro:");
			}
			{
				labelZipcode = new JLabel();
				labelZipcode.setText("CEP:");
			}
		thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap()
				.addGroup(thisLayout.createParallelGroup()
				    .addGroup(thisLayout.createSequentialGroup()
				        .addGroup(thisLayout.createParallelGroup()
				            .addComponent(labelZipcode, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				            .addComponent(labelDistrict, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				            .addComponent(labelStreet, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				            .addComponent(labelCity, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				            .addComponent(labelState, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				            .addComponent(labelRegion, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE)
				            .addComponent(labelName, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 62, GroupLayout.PREFERRED_SIZE))
				        .addGroup(thisLayout.createParallelGroup()
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(textZipcode, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 284, Short.MAX_VALUE))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(textDistrict, GroupLayout.PREFERRED_SIZE, 230, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 162, Short.MAX_VALUE))
				            .addComponent(textStreet, GroupLayout.Alignment.LEADING, 0, 392, Short.MAX_VALUE)
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(textCity, GroupLayout.PREFERRED_SIZE, 230, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 162, Short.MAX_VALUE))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(textState, GroupLayout.PREFERRED_SIZE, 94, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 298, Short.MAX_VALUE))
				            .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				                .addComponent(comboRegion, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
				                .addGap(0, 284, Short.MAX_VALUE))
				            .addGroup(thisLayout.createSequentialGroup()
				                .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
				                    .addComponent(textName, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 392, GroupLayout.PREFERRED_SIZE)
				                    .addComponent(getLabelHeadquarters(), GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 72, GroupLayout.PREFERRED_SIZE))
				                .addGap(0, 0, Short.MAX_VALUE))))
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addGroup(thisLayout.createParallelGroup()
				            .addComponent(checkHasAirport, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				            .addComponent(getButtonModify(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				        .addComponent(getButtonNearestFranchises(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				        .addComponent(getButtonDelete(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				        .addGap(0, 67, Short.MAX_VALUE)))
				.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
				.addComponent(labelNumber, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addGap(18)
				.addGroup(thisLayout.createParallelGroup()
				    .addComponent(getButtonBack(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addComponent(textNumber, GroupLayout.PREFERRED_SIZE, 57, GroupLayout.PREFERRED_SIZE)
				        .addGap(24)))
				.addContainerGap());
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
			.addContainerGap()
			.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
			    .addComponent(textName, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(labelName, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
			.addGap(16)
			.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
			    .addComponent(comboRegion, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(labelRegion, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(getLabelHeadquarters(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
			.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
			.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
			    .addComponent(textState, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(labelState, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
			.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
			.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
			    .addComponent(textCity, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(labelCity, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
			.addGap(12)
			.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
			    .addComponent(textNumber, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(textStreet, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(labelStreet, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(labelNumber, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
			.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
			.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
			    .addComponent(textDistrict, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(labelDistrict, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
			.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
			.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
			    .addComponent(textZipcode, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(labelZipcode, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
			.addGap(13)
			.addComponent(checkHasAirport, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			.addGap(20)
			.addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
			    .addComponent(getButtonBack(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(getButtonModify(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(getButtonNearestFranchises(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
			    .addComponent(getButtonDelete(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
			.addContainerGap());
			pack();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	/**
	* This method should return an instance of this class which does 
	* NOT initialize it's GUI elements. This method is ONLY required by
	* Jigloo if the superclass of this class is abstract or non-public. It 
	* is not needed in any other situation.
	 */
	public static Object getGUIBuilderInstance() {
		return new FranchiseView(Boolean.FALSE);
	}
	
	/**
	 * This constructor is used by the getGUIBuilderInstance method to
	 * provide an instance of this class which has not had it's GUI elements
	 * initialized (ie, initGUI is not called in this constructor).
	 */
	private FranchiseView(Boolean initGUI) {
		super();
	}
	
	/**
	 * Updates all the fields with the latest information.
	 */
	private void refreshView() {
		if(franchise == null) {
			JOptionPane.showMessageDialog(this, "Falha ao tentar acessar dados.", "Erro", JOptionPane.ERROR_MESSAGE);
			return;
		}
		this.setTitle(franchise.toString());
		textName.setText(franchise.getName());
		comboRegion.setSelectedItem(franchise.getAddress().getRegion());
		textState.setText(franchise.getAddress().getState());
		textCity.setText(franchise.getAddress().getCity());
		textStreet.setText(franchise.getAddress().getStreet());
		textDistrict.setText(franchise.getAddress().getDistrict());
		textNumber.setText(franchise.getAddress().getNumber());
		textZipcode.setText(franchise.getAddress().getZipcode());
		checkHasAirport.setSelected(franchise.hasAirport());
	}
	
	private JButton getButtonModify() {
		if(buttonModify == null) {
			buttonModify = new JButton();
			buttonModify.setText("Modificar Dados");
			buttonModify.setAction(getActionModify());
		}
		return buttonModify;
	}
	
	private JButton getButtonDelete() {
		if(buttonDelete == null) {
			buttonDelete = new JButton();
			buttonDelete.setText("Apagar Franquia");
			buttonDelete.setAction(getActionDelete());
		}
		return buttonDelete;
	}
	
	private JButton getButtonBack() {
		if(buttonBack == null) {
			buttonBack = new JButton();
			buttonBack.setText("Voltar");
			buttonBack.setAction(getActionBack());
		}
		return buttonBack;
	}
	
	private AbstractAction getActionBack() {
		if(actionBack == null) {
			actionBack = new AbstractAction("Voltar", null) {
				public void actionPerformed(ActionEvent evt) {
					dispose();
				}
			};
			actionBack.putValue(javax.swing.Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_V));
		}
		return actionBack;
	}
	
	private AbstractAction getActionDelete() {
		if(actionDelete == null) {
			actionDelete = new AbstractAction("Apagar Franquia", null) {
				public void actionPerformed(ActionEvent evt) {
					if((JOptionPane.showConfirmDialog(FranchiseView.this, "Tem certeza que quer apagar essa franquia?", "ATENÇÃO", 
							JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)) != 0) {
						JOptionPane.showMessageDialog(FranchiseView.this, "Operação cancelada!", "ATENÇÃO", JOptionPane.WARNING_MESSAGE);
						return;
					}
										
					try {
						headquartersController.removeFranchise(franchise);
						JOptionPane.showMessageDialog(FranchiseView.this, "Franquia removida com sucesso.");
						dispose();
					} catch (HeadquartersControllerException e) {
						JOptionPane.showMessageDialog(FranchiseView.this, e.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
					}
					
				}
			};
			actionDelete.putValue(javax.swing.Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_A));
		}
		return actionDelete;
	}
	
	private AbstractAction getActionModify() {
		if(actionModify == null) {
			actionModify = new AbstractAction("Modificar Dados", null) {
				public void actionPerformed(ActionEvent evt) {
					if((JOptionPane.showConfirmDialog(FranchiseView.this, "Tem certeza que quer modificar os dados da franquia?", "ATENÇÃO", 
							JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE)) != 0) {
						JOptionPane.showMessageDialog(FranchiseView.this, "Operação cancelada!", "ATENÇÃO", JOptionPane.WARNING_MESSAGE);
						return;
					}
					
					try {
						franchiseController.modifyFranchise(textName.getText(), textStreet.getText(), 
								textNumber.getText(), textZipcode.getText(), textDistrict.getText(), checkHasAirport.isSelected());
						JOptionPane.showMessageDialog(FranchiseView.this, "Dados atualizados com sucesso.");
					} catch (FranchiseControllerException e) {
						JOptionPane.showMessageDialog(FranchiseView.this, e.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
					}					
				}
			};
			actionModify.putValue(javax.swing.Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_M));
		}
		return actionModify;
	}
	
	@Override
	public void propertyChanged(FranchiseEvent ev) {
		//System.out.println("got event!");
		refreshView();
	}
	
	@Override
	protected void thisWindowClosed(WindowEvent evt) {
		super.thisWindowClosed(evt);
		franchise.removeFranchiseListener(this);
	}
	
	private JButton getButtonNearestFranchises() {
		if(buttonNearestFranchises == null) {
			buttonNearestFranchises = new JButton();
			buttonNearestFranchises.setText("Franquias Conectadas");
			buttonNearestFranchises.setAction(getActionNearestFranchises());
		}
		return buttonNearestFranchises;
	}
	
	private JLabel getLabelHeadquarters() {
		if(labelHeadquarters == null) {
			labelHeadquarters = new JLabel();
			labelHeadquarters.setText("MATRIZ");
			labelHeadquarters.setHorizontalAlignment(SwingConstants.CENTER);
			labelHeadquarters.setFont(new java.awt.Font("Tahoma",1,12));
		}
		return labelHeadquarters;
	}
	
	private AbstractAction getActionNearestFranchises() {
		if(actionNearestFranchises == null) {
			actionNearestFranchises = new AbstractAction("Franquias Conectadas", null) {
				public void actionPerformed(ActionEvent evt) {
					WindowManager.getInstance().openNewWindow(new NearestFranchisesView(franchise));
				}
			};
			actionNearestFranchises.putValue(javax.swing.Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_F));
		}
		return actionNearestFranchises;
	}

}
